public class Test {

    public static void main(String[] args) {

        LinkedList linkedlist = new LinkedList();

        System.out.println("头插");
        linkedlist.addFirst(1);
        linkedlist.addFirst(2);
        linkedlist.addFirst(3);
        linkedlist.addFirst(4);
        linkedlist.show();

        System.out.println("尾插");
        linkedlist.addLast(1);
        linkedlist.addLast(2);
        linkedlist.addLast(3);
        linkedlist.addLast(4);
        linkedlist.show();

        System.out.println("查找");
        System.out.println(linkedlist.contains(2));
        System.out.println(linkedlist.contains(10086));

        System.out.println("链表的长度为：" + linkedlist.size());

        System.out.println("在pos下标前插入结点");
        System.out.print("插入前：");
        linkedlist.show();
        System.out.print("插入后：");
        linkedlist.addIndext(3,10086);
        linkedlist.show();


        System.out.println("删除第一个key结点");
        linkedlist.remove(4);
        linkedlist.show();
        linkedlist.remove(4);
        linkedlist.show();

        System.out.println("删除所有的key结点");
        linkedlist.removeAllKey(1);
        linkedlist.show();


        System.out.println("清空节点");
        linkedlist.clear();
        linkedlist.show();


    }

}
